﻿/// <reference path="../HttpRequest.js" />
/// <reference path="../../utilities/Xpcom.js" />
///--------------------------------------------------------------------
/// <file name="RequestHandler.js">
///   The base handler for all request handlers.
/// </file>
///--------------------------------------------------------------------

NAMFox.ns(function() { with (NAMFox) {

this.RequestHandler = function() {
    this.priority = 2;
};

RequestHandler.prototype = {
    handleRequest: function(request) {
        /// <summary>Handles a request.</summary>
        /// <param name="request" type="HttpRequest">
        /// The HTTP request which encapsulates the document
        /// and route data for this request.
        /// </param>

        var _$ = function() { return request.$.apply(request, arguments); };
        try {
            this.handleRequestCore(request, _$);
        }
        catch (e) {
            $.error(e);
        }
    },
    
    handleRequestCore: function(request, _$) {
        throw new Error("This function must be overridden.");
    }
};

}});